//go:build wireinject

package startup

import (
	"Demo/book/internal/repository"
	"Demo/book/internal/repository/article"
	"Demo/book/internal/repository/cache"
	"Demo/book/internal/repository/dao"
	article2 "Demo/book/internal/repository/dao/article"
	"Demo/book/internal/service"
	"Demo/book/internal/web"
	ioc2 "Demo/book/ioc"
	"github.com/gin-gonic/gin"
	"github.com/google/wire"
)

var thirdProvider = wire.NewSet(ioc2.InitLogger,
	InitTestDB, InitRedis)

func InitWebServer() *gin.Engine {
	wire.Build(
		ioc2.InitLogger,
		InitTestDB, InitRedis,
		dao.NewUserDao, article2.NewGORMArticleDAO,
		cache.NewUserCache, cache.NewCodeCache,
		repository.NewUserRepository, repository.NewCodeRepository, article.NewArticleRepository,
		service.NewUserService, service.NewCodeService, service.NewArticleService,
		web.NewUserHandler, web.NewArticleHandler,
		ioc2.InitSmsService,
		ioc2.InitGin,
		ioc2.InitMiddlewares,
	)

	return new(gin.Engine)
}
